package com.yin.springboot.favorite.controller;

import com.yin.springboot.favorite.entity.Fav;
import com.yin.springboot.favorite.mapper.FavMapper;
import com.yin.springboot.favorite.service.IFavService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Yin
 * @since 2025-08-16
 */
@RestController
@RequestMapping("/fav")
public class FavController {
    @Autowired
    private FavMapper favMapper;

    @Autowired
    private IFavService favServiceImpl;

    @RequestMapping("/query")
    public List<Fav> query() {
        System.out.println(favMapper.queryByTidAndUid(2, 1));
        System.out.println("favMapper.selectList(null) = " + favMapper.selectList(null));
        return favMapper.selectList(null);
    }

    @RequestMapping("find")
    public Fav find(@RequestParam int id) {
        System.out.println(favServiceImpl.find(id));
        return favServiceImpl.find(id);
    }

}